Samba share

The idea here is to have several Samba shares exposed by the Raspberry Pi on the network. Three directories are gonna be publicly accessible and will contains the music and video files.

The following instructions assume that we want to have/media/share/music and /media/share/video both accessible on the network. Their access will not be restricted.

Install and configure Samba

To install samba on raspbian run:

sudo apt-get install samba samba-common-bin

Next step is to edit the configuration file to declare our shared directories:

sudo vim /etc/samba/smb.conf

Add the following snippet to the configuration file:

[Music]
   path = /media/share/music
   writable = yes
   read only = no
   locking = no
   guest ok = yes
   force user = guest

[Video]
   path = /media/share/video
   writable = yes
   read only = no
   locking = no
   guest ok = yes
   force user = guest

This will expose /media/share/music and /media/share/video on the network without any access control.

Then restart the samba demon in order to load the new configuration:

sudo /etc/init.d/samba restart

Accessing Samba shares

The shares can be accessed in different ways depending on the client system.

Access via file browser

With a file browser, it is possible to access the server via the following addresses:

smb://<server-ip>/video
smb://<server-ip>/music

is the IP of the machine where the samba shares where configured.

Mount the share

It is also possible to mount those directory via the following commands.

Open the fstab config file:

sudo vim /etc/fstab

Add the following line:

//<server-ip> /music /media/music/ cifs guest,uid=<user-uid>,gid=<group-user-guid>,iocharset=utf8 0 0

is the IP of the machine where the samba shares where configured. is the is the UID of the user on the machine that will access the shares. is the is the GUID of the user on the machine that will access the shares.

To get the UID and the GUID of a user called pi, simply run:

id pi

Finally, remount everything:

sudo mount -a